

var form = layui.form 
// 表单验证*********************
form.verify({     
    same: function (value) { //value：表单的值、item：表单的DOM对象
        var oldPwd = $('.xx').val()
        console.log(oldPwd)
        if (oldPwd !== value) {         
            return '两次密码不一致 请再次确认';
        }       
    }
})



// 表单提交*********************
$('form').on('submit', function (e) {
    e.preventDefault()
    var data = $(this).serialize()
    console.log(data);
    $.ajax({
        url: '/admin/users',
        type: 'POST',
        data:data,
        success: function (res) {
            console.log(res);
            layer.msg(res.message)
            if (res.status === 0) {
                location.href = './user.html'
            }
        }
        
    })
})